<?php
  require( dirname(__FILE__) . '/wp-load.php' );

  nocache_headers();

	$error = false;
	$error_msg = '';

	$child_name = (isset($_POST['child_name'])) ? trim(strip_tags($_POST['child_name'])) : null;
	$parent_name = (isset($_POST['parent_name'])) ? trim(strip_tags($_POST['parent_name'])) : null;
	$parent_idcard = (isset($_POST['parent_idcard'])) ? trim(strip_tags($_POST['parent_idcard'])) : null;

	$res = $wpdb->get_row($wpdb->prepare("SELECT * FROM wp_player WHERE idcard = %s and name = %s and parent_name = %s", 
            $parent_idcard, $child_name, $parent_name));

  //页面输出
  get_header();
  echo '<div class="content">';
  echo '<div class="reg_wrapper2">';
  
  if ($res) {
    $sn = $wpdb->get_row($wpdb->prepare("SELECT * FROM wp_kid_card WHERE player_id = %d", $res->ID));
    echo '<p class="msg">';
    echo '姓名：' . $res->name;
    echo '<br />英文名：' . $res->eng_name;
    echo '<br />父母姓名：' . $res->parent_name;
    echo '<br />身份证号码：' . $res->idcard;
    echo '<br />电话：' . $res->phone;
    echo '<br />电子邮件：' . $res->email;
    echo '<br />参选号：' . $res->player_sn;
    echo '<br />报名时间：' . date("Y-m-d", $res->reg_time);
    if ($sn) {
      echo '<br />赠送的宝宝益智乐园充值卡号：' . $sn->card_sn;
    }
    echo '</p>';
  } else {
    echo '<p class="msg">未找到符合条件的选手，请检查后<a href="' . get_bloginfo('url') . '/?page_id=205">重新查询</a>。</p>';
  }
  echo '</div>';
  echo '</div><!-- content -->';
  get_footer();

?>
